package com.chb.observer;

/**
 * @author chihb
 * @create-time 2024/10/24 22:25
 * @description
 */
public class Test {
    public static void main(String[] args) {
        Subject subject = new SubjectImpl();
        Observer observer1 = new User("孙悟空");
        Observer observer2 = new User("猪八戒");
        Observer observer3 = new User("沙悟净");
        subject.addObserver(observer1);
        subject.addObserver(observer2);
        subject.addObserver(observer3);
        subject.notifyObserver("观察者模式");
    }
}
